home *** CD-ROM | disk | FTP | other *** search
/ Quick PC 62 / Quick PC 62.iso / I386 / IIS5_01.CAB / IIS_financej.asp < prev    next >
Encoding:
Text File  |  1998-11-12  |  3.2 KB  |  138 lines

  1. <%@ LANGUAGE = JScript %>
  2. <html dir=ltr><HEAD><TITLE>Future Value Calculation</TITLE>
  3.  
  4. <META NAME="ROBOTS" CONTENT="NOINDEX"><META HTTP-EQUIV="Content-Type" content="text/html; charset=Windows-1252">
  5. </head>
  6. <SCRIPT LANGUAGE="JavaScript">
  7. <!--
  8.     TempString = navigator.appVersion
  9.     if (navigator.appName == "Microsoft Internet Explorer"){    
  10. // Check to see if browser is Microsoft
  11.         if (TempString.indexOf ("4.") >= 0){
  12. // Check to see if it is IE 4
  13.             document.writeln('<link rel="stylesheet" type="text/css" href="/iishelp/common/coua.css">');
  14.         }
  15.         else {
  16.             document.writeln('<link rel="stylesheet" type="text/css" href="/iishelp/common/cocss.css">');
  17.         }
  18.     }
  19.     else if (navigator.appName == "Netscape") {                        
  20. // Check to see if browser is Netscape
  21.         document.writeln('<link rel="stylesheet" type="text/css" href="/iishelp/common/coua.css">');
  22.     }
  23.     else
  24.         document.writeln('<link rel="stylesheet" type="text/css" href="/iishelp/common/cocss.css">');
  25. //-->
  26. </script>
  27.  
  28.  
  29.  
  30.  
  31.  
  32. <body bgcolor="#FFFFFF" text="#000000"><font face="Verdana,Arial,Helvetica">
  33.  
  34.  
  35. <% 
  36. // Check to see if an Annual Percentage Rate 
  37. // was entered 
  38.  
  39. var rate = Request("APR")(1);
  40. if (rate.substring(0,1) == "." )
  41.   rate = "0" + rate;
  42. var v = IsNumeric(rate);
  43. if  (v == true)
  44.    {
  45.     if (rate > 1) 
  46.     {
  47.     var APR = rate / 100; 
  48.      }
  49.   else 
  50.     var APR = rate;    
  51.   }
  52. else 
  53.   var APR = 0; 
  54.  
  55. // Check whether a value for Total Payments 
  56. // was entered 
  57. var totpmnt = Request("TotPmts")(1);
  58. var tp = IsNumeric(totpmnt);
  59. if (tp == true) 
  60.    {
  61.   var TotPmts = totpmnt;
  62.     }
  63. else 
  64.   var TotPmts = 0; 
  65.  
  66.  
  67. // Check whether a value for Payment Amount 
  68. // was entered 
  69. var pymnt = Request("Payment")(1);
  70. var ts = IsNumeric(pymnt);
  71. if (ts == true) 
  72.    {
  73.   var Payment = pymnt; 
  74.    }
  75. else 
  76. var Payment = 0; 
  77.  
  78.  
  79. // Check whether a value for Account Present Value 
  80. // was entered 
  81. var payval = Request("PVal")(1);
  82. var tx = IsNumeric(payval);
  83. if (tx== true) {
  84. var PVal = payval;  
  85. }
  86. else 
  87. var PVal = 0;
  88.  
  89. //Check whether user wants to make payments at the beginning or end of month.
  90. var ptype = Request("PayType")(1);
  91. if (ptype == "Beginning") 
  92.   {
  93.   var PayType = 1;  
  94.   }
  95. else 
  96.   var PayType = 0;
  97.  
  98. // Create an instance of the Finance object 
  99. Finance = Server.CreateObject("MS.Finance.Java");   
  100.  
  101.     
  102. //Use your instance of the Finance object to 
  103. // calculate the future value of the submitted 
  104. // savings plan using the HTML form and the 
  105. // CalcFV method 
  106. FVal = Finance.CalcFV(APR / 12, TotPmts, -Payment, -PVal, PayType) 
  107.  
  108. var Savings = NumFormat(FVal);
  109.  
  110. //Function for determining if form value is a number.    
  111. function IsNumeric(str) {
  112.   for (var i=0; i < str.length; i++){
  113.     var ch = str.substring(i, i+1)          
  114.     if( ch < "0" || ch>"9" || str.length == null){
  115.       return false;
  116.     }
  117.   }
  118.   return true;
  119. }
  120.  
  121. //Function for limiting return values to two places after decimal point.
  122. function NumFormat(str) {
  123.         str = "" + str + "00";      
  124.         return (str.substring (0, str.indexOf (".") + 3));
  125.     }
  126.  
  127.  
  128. %>
  129.  
  130. <h3><A NAME="H3_37662227"></A>Your savings will be worth $ <%= Savings%>.</h3>
  131.  
  132.  
  133.  
  134. </FONT>
  135.  
  136. </BODY> 
  137. </HTML> 
  138.